<template>
  <el-row type="flex" justify="space-between" align="middle">
    <div>
      <span>已选标签</span>
      <span>({{ resultList.length }})</span>
    </div>
    <BtnRender :render="renderBtnsBar" />
  </el-row>
</template>
<script>
import BtnRender from '@/components/JSXRender/BtnRender';
import { getListPageBtnsBar } from '@/utils/getBtnsRender';
export default {
  components: {
    BtnRender,
  },
  props: {
    resultList: { // 结果集合
      type: Array,
      default: () => [],
    },
  },
  methods: {
    // 渲染按钮
    renderBtnsBar (h) {
      const btns = [
        {
          label: '一键清空',
          disabled: this.resultList.length == 0,
          method: this.handleClear,
        },
        {
          label: '确定',
          method: this.handleConfirm,
        },
      ]
      return getListPageBtnsBar(h, btns, null, 'end', { type: 'text', size: 'mini' })
    },
    // 清空
    handleClear () {
      this.$emit('clear')
    },
    // 确定
    handleConfirm () {
      this.$emit('confirm')
    },
  }
}
</script>
